<div class="print" id="print">
    <button class="btn btn-default no-print" id="print_btn" type="submit" onclick="print_w()" >打印</button>
    {volist name="list" id="vo"}
        <p style="height:0.1cm"></p>
        <table style="margin-left:1cm;">
          <tr>
            <td align="center" colspan="2" style="font-size: 16px;">{$vo.name}</td>
          </tr>
          <tr>
            <td class="qrcod_data" rowspan="6" width="130">
              <input type="hidden" class="qrcode_txt" value="{$vo.qrcodeval}">
              <div class="qrcode_img" id="qrcode_img_{$i}"></div>
            </td>
            <td>编码：<span id="inv_id_{$i}">{$vo.number}</span></td>
          </tr>
          <tr>
            <td >规格型号：{$vo.specification}</td>
          </tr>
          <tr>
            <td >基本单位：{$vo.unit}</td>
          </tr>
          <tr>
            <td>常用单位：{$vo.store_unit}</td>
          </tr>
          <tr>
            <td>
              批&nbsp;&nbsp;&nbsp;&nbsp;号：<input type="text" class="mbatch" value="{$vo.cBatch}" 
              oninput="showQrcode({$i})" id="cBatch_{$i}" style="width: 90px;">
            </td>
          </tr>
          <tr>
            <td>
              流水号：<input type="text" class="mbatch" value="" 
              oninput="showQrcode({$i})" id="qrNo_{$i}" style="width: 90px;"> 
            </td>
          </tr>
          </table>
            {if condition="$i neq count($list)"}
            <div class="pagebreak"></div>
            {/if}
    {/volist}
<style>
table{
    border-collapse: collapse;
    width: 8.4cm;
    max-height:  5.4cm;
    font-size: 14px;
    margin-left: 0.18cm;
    font-weight: 600;
    font-family: "微软雅黑"
}
tbody, td {
    border: 0px solid #000;
    padding: 0 2px;
}
.qrcode_img{
    width: 120px;
    height: 120px;
}
.mbatch{
  border: none;
  border-bottom: 1px solid #000;
}
@page{
    size:auto;
    margin:0mm;
}
@media print {
    .pagebreak {
        clear: both;
        page-break-after: always;
    }
    .mbatch{
        border: none;
    }
}
</style>
</div>

<script>
  function print_w(){
      //渲染后，打印后才有值
      $(".mbatch").each(function() {
        $(this).attr("value", $(this).val());
      });

      let oldBody = $("body").html() // 保存
      $("body").html($("#print").html());

       window.print();
       $("body").html(oldBody) // 恢复
    }
</script>